package com.mc2.docapp.disabilityassessmenttool.LowerLimb;

import io.realm.RealmObject;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class C_llca_knee extends RealmObject {
    private LLCustDataType flexion_extension_arc = new LLCustDataType();
    private LLInnerCalculations inner_calculations = new LLInnerCalculations();

    public void calc(C_llca_knee c_llca_knee) {
        double a = c_llca_knee.getFlexion_extension_arc().getActual_right();

        double pa = perc(a, c_llca_knee.getFlexion_extension_arc().getNormal());

        double x = pa;

        //
        c_llca_knee.getFlexion_extension_arc().setPerc_loss_right(pa);
        //

        a = c_llca_knee.getFlexion_extension_arc().getActual_left();
        pa = perc(a, c_llca_knee.getFlexion_extension_arc().getNormal());
        double y = pa;

        //
        c_llca_knee.getFlexion_extension_arc().setPerc_loss_left(pa);
        //

        c_llca_knee.setInner_calculations(new LLInnerCalculations(
                x,
                y,
                x * 0.35,
                y * 0.35
        ));
    }

    private double perc(double a, double normal) {
        return ((normal - a) * 100d) / (normal + 0d);
    }

}